package com.iot.service.mqtt.bridge;

import com.iot.service.mqtt.bridge.kafka.KafkaBridgeObserver;
import com.iot.service.mqtt.bridge.db.MySqlBridgeObserver;
import com.iot.service.mqtt.model.request.TlMqttPublishReq;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @Author: hszhou
 * @Date: 2025/5/12 15:02
 * @Description: 必须描述类做什么事情, 实现什么功能
 */
@Slf4j
@Service
public class TlBridgeService {

    private final KafkaBridgeObserver kafkaBridgeObserver;

    private final MySqlBridgeObserver mySqlBridgeObserver;

    private final TlSubject subject;

    public TlBridgeService() {
         subject = new TlSubject();
         kafkaBridgeObserver = new KafkaBridgeObserver(subject);
         mySqlBridgeObserver = new MySqlBridgeObserver(subject);
    }


    public void bridge(String clientId,int qos, TlMqttPublishReq message){
        subject.notifyAllObservers(clientId,qos,message);
    }
}
